package com.travel.Service.Impl;

import com.travel.Bean.Record;
import com.travel.JPA.RecoedJPA;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
public class RecordServiceImpl {

    @Autowired
    private RecoedJPA recoedJPA;

    /**
     * 保存trecord 6
     * 保存trecord 6（待支付）
     *
     * @param records trecords
     * @return {@link Integer}
     */
    public Integer saveRecord_6(List<Record> records){

       try{
           recoedJPA.saveAll(records);
       }catch (Exception e){
           return 1;
       }
       return 0;
   }

    /**
     * 更新trecord 1(待使用)
     *
     * @param orderID 订单id
     * @return {@link Integer}
     */
    @Transactional
    public Integer UpdateTrecord_1(String orderID){
        try{
            recoedJPA.updateRecord(orderID);
        }catch (Exception e){
            return 1;
        }
        return 0;
    }

}
